package com.bdqn.biz;

import com.bdqn.dao.BaseDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;

@WebServlet(name = "ajax3", value = "/ajax3")
public class ajax3 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.setCharacterEncoding("utf8");
        //去数据库把str 中的id 删除掉 4，5，6，
        String str=request.getParameter("str");
        //4,5,6
        String str1=str.substring(0,str.length()-1);
        String cc="delete from newtable where id in ("+str1+")";
        String result="no";
        try {
            int rr=BaseDao.update(cc,
                    new Object[]{}
                    );
            if(rr>=1)
            {
                result="ok";
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        //后台
        PrintWriter writer=response.getWriter();
        writer.write(result);

    }
}
